home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / util / arc / xadmaster.lha / xad / Developer / Include / C / libraries / xadmaster.h
Encoding:
C/C++ Source or Header  |  2000-08-31  |  29.9 KB  |  693 lines

  1. #ifndef LIBRARIES_XADMASTER_H
  2. #define LIBRARIES_XADMASTER_H
  3.  
  4. /*
  5. **    $VER: xadmaster.h 8.0 (20.08.2000)
  6. **    xadmaster.library defines and structures
  7. **
  8. **    Copyright © 1998-2000 by Dirk Stöcker
  9. **    All Rights Reserved.
  10. */
  11.  
  12. #ifndef EXEC_LIBRARIES_H
  13. #include <exec/libraries.h>
  14. #endif
  15.  
  16. #ifndef UTILITY_TAGITEM_H
  17. #include <utility/tagitem.h>
  18. #endif
  19.  
  20. #define     XADNAME  "xadmaster.library"
  21.  
  22. /* NOTE: Nearly all structures need to be allocated using the
  23.    xadAllocObject function. */
  24.  
  25. /************************************************************************
  26. *                                                *
  27. *    library base structure                        *
  28. *                                                *
  29. ************************************************************************/
  30.  
  31. struct xadMasterBase {
  32.   struct Library       xmb_LibNode;
  33.   struct ExecBase *    xmb_SysBase;
  34.   struct DosLibrary *  xmb_DOSBase;
  35.   struct UtilityBase * xmb_UtilityBase;
  36.   ULONG               xmb_RecogSize;    /* read only */
  37.   STRPTR           xmb_DefaultName; /* name for XADFIF_NOFILENAME (V6) */
  38. };
  39.  
  40. /************************************************************************
  41. *                                                *
  42. *    tag-function call flags                               *
  43. *                                                *
  44. ************************************************************************/
  45.  
  46. /* input tags for xadGetInfo, only one can be specified per call */
  47. #define XAD_INSIZE        (TAG_USER+  1) /* input data size */
  48. #define XAD_INFILENAME        (TAG_USER+  2)
  49. #define XAD_INFILEHANDLE    (TAG_USER+  3)
  50. #define XAD_INMEMORY        (TAG_USER+  4)
  51. #define XAD_INHOOK        (TAG_USER+  5)
  52. #define XAD_INSPLITTED        (TAG_USER+  6) /* (V2) */
  53. #define XAD_INDISKARCHIVE    (TAG_USER+  7) /* (V4) */
  54. #define XAD_INXADSTREAM        (TAG_USER+  8) /* (V8) */
  55.  
  56. /* output tags, only one can be specified per call, xadXXXXUnArc */
  57. #define XAD_OUTSIZE        (TAG_USER+ 10) /* output data size */
  58. #define XAD_OUTFILENAME        (TAG_USER+ 11)
  59. #define XAD_OUTFILEHANDLE    (TAG_USER+ 12)
  60. #define XAD_OUTMEMORY        (TAG_USER+ 13)
  61. #define XAD_OUTHOOK        (TAG_USER+ 14)
  62. #define XAD_OUTDEVICE        (TAG_USER+ 15) /* for disk archives only */
  63. #define XAD_OUTXADSTREAM    (TAG_USER+ 16) /* (V8) */
  64.  
  65. /* object allocation tags for xadAllocObjectA */
  66. #define XAD_OBJNAMESIZE        (TAG_USER+ 20) /* XADOBJ_FILEINFO, size of needed name space */
  67. #define XAD_OBJCOMMENTSIZE    (TAG_USER+ 21) /* XADOBJ_FILEINFO, size of needed comment space */
  68. #define XAD_OBJPRIVINFOSIZE    (TAG_USER+ 22) /* XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size */
  69. #define XAD_OBJBLOCKENTRIES    (TAG_USER+ 23) /* XADOBJ_DISKINFO, number of needed entries */
  70.  
  71. /* tags for xadGetInfo, xadFileUnArc and xadDiskUnArc */
  72. #define XAD_NOEXTERN        (TAG_USER+ 50) /* do not use extern clients */
  73. #define XAD_PASSWORD        (TAG_USER+ 51) /* password when needed */
  74. #define XAD_ENTRYNUMBER        (TAG_USER+ 52) /* number of wanted entry */
  75. #define XAD_PROGRESSHOOK    (TAG_USER+ 53) /* the progress hook */
  76. #define XAD_OVERWRITE        (TAG_USER+ 54) /* overwrite file ? */
  77. #define XAD_MAKEDIRECTORY    (TAG_USER+ 55) /* create directory tree */
  78. #define XAD_IGNOREGEOMETRY    (TAG_USER+ 56) /* ignore drive geometry ? */
  79. #define XAD_LOWCYLINDER        (TAG_USER+ 57) /* lowest cylinder */
  80. #define XAD_HIGHCYLINDER    (TAG_USER+ 58) /* highest cylinder */
  81. #define XAD_VERIFY        (TAG_USER+ 59) /* verify for disk hook */
  82. #define XAD_NOKILLPARTIAL    (TAG_USER+ 60) /* do not delete partial/corrupt files (V3.3) */
  83. #define XAD_FORMAT        (TAG_USER+ 61) /* format output device (V5) */
  84.  
  85. /* input tags for xadConvertDates, only one can be passed */
  86. #define XAD_DATEUNIX        (TAG_USER+ 70) /* unix date variable */
  87. #define XAD_DATEAMIGA        (TAG_USER+ 71) /* amiga date variable */
  88. #define XAD_DATEDATESTAMP    (TAG_USER+ 72) /* struct DateStamp */
  89. #define XAD_DATEXADDATE        (TAG_USER+ 73) /* struct xadDate */
  90. #define XAD_DATECLOCKDATA    (TAG_USER+ 74) /* struct ClockData */
  91. #define XAD_DATECURRENTTIME    (TAG_USER+ 75) /* input is system time */
  92. #define XAD_DATEMSDOS        (TAG_USER+ 76) /* MS-DOS packed format (V2) */
  93. #define XAD_DATEMAC        (TAG_USER+ 77) /* Mac date variable (V8) */
  94.  
  95. /* output tags, there can be specified multiple tags for one call */
  96. #define XAD_GETDATEUNIX        (TAG_USER+ 80) /* unix date variable */
  97. #define XAD_GETDATEAMIGA    (TAG_USER+ 81) /* amiga date variable */
  98. #define XAD_GETDATEDATESTAMP    (TAG_USER+ 82) /* struct DateStamp */
  99. #define XAD_GETDATEXADDATE    (TAG_USER+ 83) /* struct xadDate */
  100. #define XAD_GETDATECLOCKDATA    (TAG_USER+ 84) /* struct ClockData */
  101. #define XAD_GETDATEMSDOS    (TAG_USER+ 86) /* MS-DOS packed format (V2) */
  102. #define XAD_GETDATEMAC        (TAG_USER+ 87) /* Mac date variable (V8) */
  103.  
  104. /* following tags need locale.library to be installed */
  105. #define XAD_MAKEGMTDATE        (TAG_USER+ 90) /* make local to GMT time */
  106. #define XAD_MAKELOCALDATE    (TAG_USER+ 91) /* make GMT to local time */
  107.  
  108. /* tags for xadHookTagAccess (V3) */
  109. #define XAD_USESKIPINFO        (TAG_USER+104) /* the hook uses xadSkipInfo (V3) */
  110.  
  111. #define XAD_GETCRC16        (TAG_USER+120) /* pointer to UWORD value (V3) */
  112. #define XAD_GETCRC32        (TAG_USER+121) /* pointer to ULONG value (V3) */
  113.  
  114. #define XAD_CRC16ID        (TAG_USER+130) /* ID for crc calculation (V3) */
  115. #define XAD_CRC32ID        (TAG_USER+131) /* ID for crc calculation (V3) */
  116.  
  117. /* tags for xadConvertProtection (V4) */
  118. #define XAD_PROTAMIGA        (TAG_USER+160) /* Amiga type protection bits (V4) */
  119. #define XAD_PROTUNIX        (TAG_USER+161) /* protection bits in UNIX mode (V4) */
  120. #define XAD_PROTMSDOS        (TAG_USER+162) /* MSDOS type protection bits (V4) */
  121.  
  122. #define XAD_GETPROTAMIGA    (TAG_USER+170) /* return Amiga protection bits (V4) */
  123.  
  124. /* tags for xadGetDiskInfo (V7) */
  125. #define XAD_STARTCLIENT        (TAG_USER+180) /* the client to start with (V7) */
  126. #define XAD_NOEMPTYERROR    (TAG_USER+181) /* do not create XADERR_EMPTY (V8) */
  127.  
  128. /* tags for xadFreeHookAccess (V8) */
  129. #define XAD_WASERROR        (TAG_USER+190) /* error occured, call abort method (V8) */
  130.  
  131. /* tags for miscellaneous stuff */
  132. #define XAD_ARCHIVEINFO        (TAG_USER+200) /* xadArchiveInfo for stream hooks (V8) */
  133.  
  134.  
  135. /************************************************************************
  136. *                                                *
  137. *    objects for xadAllocObjectA                           *
  138. *                                                *
  139. ************************************************************************/
  140.  
  141. #define XADOBJ_ARCHIVEINFO    0x0001 /* struct xadArchiveInfo */
  142. #define XADOBJ_FILEINFO        0x0002 /* struct xadFileInfo */
  143. #define XADOBJ_DISKINFO        0x0003 /* struct xadDiskInfo */
  144. #define XADOBJ_HOOKPARAM    0x0004 /* struct HookParam */
  145. #define XADOBJ_DEVICEINFO    0x0005 /* struct xadDeviceInfo */
  146. #define XADOBJ_PROGRESSINFO    0x0006 /* struct xadProgressInfo */
  147. #define XADOBJ_TEXTINFO        0x0007 /* struct xadTextInfo */
  148. #define XADOBJ_SPLITFILE    0x0008 /* struct xadSplitFile (V2) */
  149. #define XADOBJ_SKIPINFO        0x0009 /* struct xadSkipInfo (V3) */
  150. #define XADOBJ_IMAGEINFO    0x000A /* struct xadImageInfo (V4) */
  151.  
  152. /* result type of xadAllocVec */
  153. #define XADOBJ_MEMBLOCK        0x0100 /* memory of requested size and type */
  154.  
  155. /************************************************************************
  156. *                                                *
  157. *    modes for xadCalcCRC126 and xadCalcCRC32                *
  158. *                                                *
  159. ************************************************************************/
  160.  
  161. #define XADCRC16_ID1        0xA001
  162. #define XADCRC32_ID1        0xEDB88320
  163.  
  164. /************************************************************************
  165. *                                                *
  166. *    hook related stuff                                *
  167. *                                                *
  168. ************************************************************************/
  169.  
  170. #define XADHC_READ    1    /* read data into buffer */
  171. #define XADHC_WRITE    2    /* write buffer data to file/memory */
  172. #define XADHC_SEEK    3    /* seek in file */
  173. #define XADHC_INIT    4    /* initialize the hook */
  174. #define XADHC_FREE    5    /* end up hook work, free stuff */
  175. #define XADHC_ABORT    6    /* an error occured, delete partial stuff */
  176. #define XADHC_FULLSIZE    7    /* complete input size is needed */
  177. #define XADHC_IMAGEINFO    8    /* return disk image info (V4) */
  178.  
  179. struct xadHookParam {
  180.   ULONG xhp_Command;
  181.   LONG  xhp_CommandData;
  182.   APTR  xhp_BufferPtr;
  183.   ULONG xhp_BufferSize;
  184.   ULONG xhp_DataPos;        /* current seek position */
  185.   APTR  xhp_PrivatePtr;
  186. };
  187.  
  188. /* xadHookAccess commands */
  189. #define XADAC_READ        10    /* get data */
  190. #define    XADAC_WRITE        11    /* write data */
  191. #define XADAC_COPY        12    /* copy input to output */
  192. #define XADAC_INPUTSEEK        13    /* seek in input file */
  193. #define XADAC_OUTPUTSEEK    14    /* seek in output file */
  194.  
  195. /************************************************************************
  196. *                                                *
  197. *    support structures                              *
  198. *                                                *
  199. ************************************************************************/
  200.  
  201. /* Own date structure to cover all possible dates in a human friendly
  202.    format. xadConvertDates may be used to convert between different date
  203.    structures and variables. */
  204. struct xadDate {
  205.   ULONG xd_Micros;    /* values 0 to 999999     */
  206.   LONG  xd_Year;    /* values 1 to 2147483648 */
  207.   UBYTE xd_Month;    /* values 1 to 12         */
  208.   UBYTE xd_WeekDay;    /* values 1 to 7          */
  209.   UBYTE xd_Day;        /* values 1 to 31         */
  210.   UBYTE xd_Hour;    /* values 0 to 23         */
  211.   UBYTE xd_Minute;    /* values 0 to 59         */
  212.   UBYTE xd_Second;    /* values 0 to 59         */
  213. };
  214.  
  215. #define XADDAY_MONDAY        1    /* monday is the first day and */
  216. #define XADDAY_TUESDAY        2
  217. #define XADDAY_WEDNESDAY    3
  218. #define XADDAY_THURSDAY        4
  219. #define XADDAY_FRIDAY        5
  220. #define XADDAY_SATURDAY     6
  221. #define XADDAY_SUNDAY        7    /* sunday the last day of a week */
  222.  
  223. struct xadDeviceInfo { /* for XAD_OUTDEVICE tag */
  224.   STRPTR xdi_DeviceName; /* name of device */
  225.   ULONG  xdi_Unit;     /* unit of device */
  226.   STRPTR xdi_DOSName;     /* instead of Device+Unit, dos name without ':' */
  227. };
  228.  
  229. struct xadSplitFile { /* for XAD_INSPLITTED */
  230.   struct xadSplitFile *xsf_Next;
  231.   ULONG               xsf_Type; /* XAD_INFILENAME, XAD_INFILEHANDLE, XAD_INMEMORY, XAD_INHOOK */
  232.   ULONG               xsf_Size; /* necessary for XAD_INMEMORY, useful for others */
  233.   ULONG               xsf_Data; /* FileName, Filehandle, Hookpointer or Memory */
  234. };
  235.  
  236. struct xadSkipInfo {
  237.   struct xadSkipInfo *xsi_Next;
  238.   ULONG              xsi_Position; /* position, where it should be skipped */
  239.   ULONG              xsi_SkipSize; /* size to skip */
  240. };
  241.  
  242. struct xadImageInfo { /* for XADHC_IMAGEINFO */
  243.   ULONG xii_SectorSize;   /* usually 512 */
  244.   ULONG xii_FirstSector;  /* of the image file */
  245.   ULONG xii_NumSectors;   /* of the image file */
  246.   ULONG xii_TotalSectors; /* of this device type */
  247. };
  248. /* If the image file holds total data of disk xii_TotalSectors equals
  249.    xii_NumSectors and xii_FirstSector is zero. Addition of xii_FirstSector
  250.    and xii_NumSectors cannot exceed xii_TotalSectors value!
  251. */
  252.  
  253. /************************************************************************
  254. *                                                *
  255. *    information structures                              *
  256. *                                                *
  257. ************************************************************************/
  258.  
  259. struct xadArchiveInfo {
  260.   struct xadClient *   xai_Client;   /* pointer to unarchiving client */
  261.   APTR               xai_PrivateClient; /* private client data */
  262.   STRPTR           xai_Password; /* password for crypted archives */
  263.   ULONG               xai_Flags;    /* read only XADAIF_ flags */
  264.   ULONG               xai_LowCyl;   /* lowest cylinder to unarchive */
  265.   ULONG               xai_HighCyl;  /* highest cylinder to unarchive */
  266.   ULONG               xai_InPos;    /* input position, read only */
  267.   ULONG               xai_InSize;   /* input size, read only */
  268.   ULONG               xai_OutPos;   /* output position, read only */
  269.   ULONG               xai_OutSize;  /* output file size, read only */
  270.   struct xadFileInfo * xai_FileInfo; /* data pointer for file arcs */
  271.   struct xadDiskInfo * xai_DiskInfo; /* data pointer for disk arcs */
  272.   struct xadFileInfo * xai_CurFile;  /* data pointer for current file arc */
  273.   struct xadDiskInfo * xai_CurDisk;  /* data pointer for current disk arc */
  274.   LONG               xai_LastError;   /* last error, when XADAIF_FILECORRUPT (V2) */
  275.   ULONG *           xai_MultiVolume; /* array of start offsets from parts (V2) */
  276.   struct xadSkipInfo * xai_SkipInfo;    /* linked list of skip entries (V3) */
  277.   struct xadImageInfo *xai_ImageInfo;   /* for filesystem clients (V5) */
  278.   STRPTR           xai_InName;   /* Input archive name if available (V7) */
  279. };
  280. /* This structure is nearly complete private to either xadmaster or its
  281. clients. An application program may access for reading only xai_Client,
  282. xai_Flags, xai_FileInfo and xai_DiskInfo. For xai_Flags only XADAIF_CRYPTED
  283. and XADAIF_FILECORRUPT are useful. All the other stuff is private and should
  284. not be accessed! */
  285.  
  286. #define XADAIB_CRYPTED         0 /* archive entries are encrypted */
  287. #define XADAIB_FILECORRUPT     1 /* file is corrupt, but valid entries are in the list */
  288. #define XADAIB_FILEARCHIVE     2 /* unarchive file entry */
  289. #define XADAIB_DISKARCHIVE     3 /* unarchive disk entry */
  290. #define XADAIB_OVERWRITE     4 /* overwrite the file (PRIVATE) */
  291. #define XADAIB_MAKEDIRECTORY     5 /* create directory when missing (PRIVATE) */
  292. #define XADAIB_IGNOREGEOMETRY     6 /* ignore drive geometry (PRIVATE) */
  293. #define XADAIB_VERIFY         7 /* verify is turned on for disk hook (PRIVATE) */
  294. #define XADAIB_NOKILLPARTIAL     8 /* do not delete partial files (PRIVATE) */
  295. #define XADAIB_DISKIMAGE     9 /* is disk image extraction (V5) */
  296. #define XADAIB_FORMAT        10 /* format in disk hook (PRIVATE) */
  297. #define XADAIB_NOEMPTYERROR    11 /* do not create empty error (PRIVATE) */
  298. #define XADAIB_ONLYIN        12 /* in stuff only (PRIVATE) */
  299. #define XADAIB_ONLYOUT        13 /* out stuff only (PRIVATE) */
  300.  
  301. #define XADAIF_CRYPTED        (1<<XADAIB_CRYPTED)
  302. #define XADAIF_FILECORRUPT    (1<<XADAIB_FILECORRUPT)
  303. #define XADAIF_FILEARCHIVE    (1<<XADAIB_FILEARCHIVE)
  304. #define XADAIF_DISKARCHIVE    (1<<XADAIB_DISKARCHIVE)
  305. #define XADAIF_OVERWRITE    (1<<XADAIB_OVERWRITE)
  306. #define XADAIF_MAKEDIRECTORY    (1<<XADAIB_MAKEDIRECTORY)
  307. #define XADAIF_IGNOREGEOMETRY    (1<<XADAIB_IGNOREGEOMETRY)
  308. #define XADAIF_VERIFY        (1<<XADAIB_VERIFY)
  309. #define XADAIF_NOKILLPARTIAL    (1<<XADAIB_NOKILLPARTIAL)
  310. #define XADAIF_DISKIMAGE    (1<<XADAIB_DISKIMAGE)
  311. #define XADAIF_FORMAT        (1<<XADAIB_FORMAT)
  312. #define XADAIF_NOEMPTYERROR    (1<<XADAIB_NOEMPTYERROR)
  313. #define XADAIF_ONLYIN        (1<<XADAIB_ONLYIN)
  314. #define XADAIF_ONLYOUT        (1<<XADAIB_ONLYOUT)
  315.  
  316. struct xadFileInfo {
  317.   struct xadFileInfo * xfi_Next;
  318.   ULONG               xfi_EntryNumber;/* number of entry, starts with 1 */
  319.   STRPTR           xfi_EntryInfo;  /* additional archiver text */
  320.   APTR               xfi_PrivateInfo;/* client private, see XAD_OBJPRIVINFOSIZE */
  321.   ULONG               xfi_Flags;      /* see XADFIF_xxx defines */
  322.   STRPTR           xfi_FileName;   /* see XAD_OBJNAMESIZE tag */
  323.   STRPTR           xfi_Comment;    /* see XAD_OBJCOMMENTSIZE tag */
  324.   ULONG             xfi_Protection; /* OS 3 bits (including multiuser) */
  325.   ULONG               xfi_OwnerUID;   /* user ID */
  326.   ULONG               xfi_OwnerGID;   /* group ID */
  327.   STRPTR           xfi_UserName;   /* user name */
  328.   STRPTR           xfi_GroupName;  /* group name */
  329.   ULONG                xfi_Size;       /* size of this file */
  330.   ULONG               xfi_GroupCrSize;/* crunched size of group */
  331.   ULONG               xfi_CrunchSize; /* crunched size */
  332.   STRPTR           xfi_LinkName;   /* name and path of link */
  333.   struct xadDate       xfi_Date;
  334.   UWORD               xfi_Generation; /* File Generation [0...0xFFFF] (V3) */
  335.   ULONG               xfi_DataPos;    /* crunched data position (V3) */
  336.   struct xadFileInfo * xfi_MacFork;    /* pointer to 2nd fork for Mac (V7) */
  337. };
  338.  
  339. /* Multiuser fields (xfi_OwnerUID, xfi_OwnerUID, xfi_UserName, xfi_GroupName)
  340.    and multiuser bits (see <dos/dos.h>) are currently not supported with normal
  341.    Amiga filesystem. But the clients support them, if archive format holds
  342.    such information.
  343. */
  344.  
  345. #define XADFIB_CRYPTED        0 /* entry is crypted */
  346. #define XADFIB_DIRECTORY    1 /* entry is a directory */
  347. #define XADFIB_LINK        2 /* entry is a link */
  348. #define XADFIB_INFOTEXT        3 /* file is an information text */
  349. #define XADFIB_GROUPED        4 /* file is in a crunch group */
  350. #define XADFIB_ENDOFGROUP    5 /* crunch group ends here */
  351. #define XADFIB_NODATE        6 /* no date supported, CURRENT date is set */
  352. #define XADFIB_DELETED        7 /* file is marked as deleted (V3) */
  353. #define XADFIB_SEEKDATAPOS    8 /* before unarchiving the datapos is set (V3) */
  354. #define XADFIB_NOFILENAME    9 /* there was no filename, using internal one (V6) */
  355. #define XADFIB_NOUNCRUNCHSIZE  10 /* file size is unknown and thus set to zero (V6) */
  356. #define XADFIB_PARTIALFILE     11 /* file is only partial (V6) */
  357. #define XADFIB_MACDATA           12 /* file is Apple data fork (V7) */
  358. #define XADFIB_MACRESOURCE     13 /* file is Apple resource fork (V7) */
  359.  
  360. #define XADFIF_CRYPTED        (1<<XADFIB_CRYPTED)
  361. #define XADFIF_DIRECTORY    (1<<XADFIB_DIRECTORY)
  362. #define XADFIF_LINK        (1<<XADFIB_LINK)
  363. #define XADFIF_INFOTEXT        (1<<XADFIB_INFOTEXT)
  364. #define XADFIF_GROUPED        (1<<XADFIB_GROUPED)
  365. #define XADFIF_ENDOFGROUP    (1<<XADFIB_ENDOFGROUP)
  366. #define XADFIF_NODATE        (1<<XADFIB_NODATE)
  367. #define XADFIF_DELETED        (1<<XADFIB_DELETED)
  368. #define XADFIF_SEEKDATAPOS    (1<<XADFIB_SEEKDATAPOS)
  369. #define XADFIF_NOFILENAME    (1<<XADFIB_NOFILENAME)
  370. #define XADFIF_NOUNCRUNCHSIZE    (1<<XADFIB_NOUNCRUNCHSIZE)
  371. #define XADFIF_PARTIALFILE    (1<<XADFIB_PARTIALFILE)
  372. #define XADFIF_MACDATA        (1<<XADFIB_MACDATA)
  373. #define XADFIF_MACRESOURCE    (1<<XADFIB_MACRESOURCE)
  374.  
  375. /* NOTE: the texts passed with that structure must not always be printable.
  376.    Although the clients should add an additional (not counted) zero at the text
  377.    end, the whole file may contain other unprintable stuff (e.g. for DMS).
  378.    So when printing this texts do it on a byte for byte base including
  379.    printability checks.
  380. */
  381. struct xadTextInfo {
  382.   struct xadTextInfo *    xti_Next;
  383.   ULONG            xti_Size;  /* maybe zero - no text - e.g. when crypted */
  384.   STRPTR        xti_Text;  /* and there is no password in xadGetInfo() */
  385.   ULONG            xti_Flags; /* see XADTIF_xxx defines */
  386. };
  387.  
  388. #define XADTIB_CRYPTED        0 /* entry is empty, as data was crypted */
  389. #define XADTIB_BANNER        1 /* text is a banner */
  390. #define XADTIB_FILEDIZ        2 /* text is a file description */
  391.  
  392. #define XADTIF_CRYPTED        (1<<XADTIB_CRYPTED)
  393. #define XADTIF_BANNER        (1<<XADTIB_BANNER)
  394. #define XADTIF_FILEDIZ        (1<<XADTIB_FILEDIZ)
  395.  
  396. struct xadDiskInfo {
  397.   struct xadDiskInfo *  xdi_Next;
  398.   ULONG                xdi_EntryNumber;  /* number of entry, starts with 1 */
  399.   STRPTR            xdi_EntryInfo;    /* additional archiver text */
  400.   APTR                xdi_PrivateInfo;  /* client private, see XAD_OBJPRIVINFOSIZE */
  401.   ULONG            xdi_Flags;      /* see XADDIF_xxx defines */
  402.   ULONG                xdi_SectorSize;
  403.   ULONG            xdi_TotalSectors; /* see devices/trackdisk.h */
  404.   ULONG                xdi_Cylinders;      /* to find out what these */
  405.   ULONG                xdi_CylSectors;      /* fields mean, they are equal */
  406.   ULONG                xdi_Heads;      /* to struct DriveGeometry */
  407.   ULONG            xdi_TrackSectors;
  408.   ULONG                xdi_LowCyl;       /* lowest cylinder stored */
  409.   ULONG                xdi_HighCyl;      /* highest cylinder stored */
  410.   ULONG            xdi_BlockInfoSize;/* number of BlockInfo entries */
  411.   UBYTE *        xdi_BlockInfo;    /* see XADBIF_xxx defines and XAD_OBJBLOCKENTRIES tag */
  412.   struct xadTextInfo *    xdi_TextInfo;      /* linked list with info texts */
  413.   ULONG                xdi_DataPos;      /* crunched data position (V3) */
  414. };
  415.  
  416. /* BlockInfo points to a UBYTE field for every track from first sector of
  417.    lowest cylinder to last sector of highest cylinder. When not used,
  418.    pointer must be 0. Do not use it, when there are no entries!
  419.    This is just for information. The applications still asks the client
  420.    to unarchive whole cylinders and not archived blocks are cleared for
  421.    unarchiving.
  422. */
  423.  
  424. #define XADDIB_CRYPTED          0 /* entry is crypted */
  425. #define XADDIB_SEEKDATAPOS      1 /* before unarchiving the datapos is set (V3) */
  426.  
  427. /* Some of the crunchers do not store all necessary information, so it
  428. may be needed to guess some of them. Set the following flags in that case
  429. and geometry check will ignore these fields. */
  430. #define XADDIB_GUESSCYLINDERS      7 /* cylinder number is guessed */
  431. #define XADDIB_GUESSCYLSECTORS      8 /* cylsectors is guessed */
  432. #define XADDIB_GUESSHEADS      9 /* number of heads is guessed */
  433. #define XADDIB_GUESSTRACKSECTORS 10 /* tracksectors is guessed */
  434. #define XADDIB_GUESSLOWCYL     11 /* lowcyl is guessed */
  435. #define XADDIB_GUESSHIGHCYL     12 /* highcyl is guessed */
  436.  
  437. /* If it is impossible to set some of the fields, you need to set some of
  438. these flags. NOTE: XADDIB_NOCYLINDERS is really important, as this turns
  439. of usage of lowcyl and highcyl keywords. When you have cylinder information,
  440. you should not use these and instead use guess flags and calculate
  441. possible values for the missing fields. */
  442. #define XADDIB_NOCYLINDERS     15 /* cylinder number is not set */
  443. #define XADDIB_NOCYLSECTORS     16 /* cylsectors is not set */
  444. #define XADDIB_NOHEADS          17 /* number of heads is not set */
  445. #define XADDIB_NOTRACKSECTORS    18 /* tracksectors is not set */
  446. #define XADDIB_NOLOWCYL          19 /* lowcyl is not set */
  447. #define XADDIB_NOHIGHCYL     20 /* highcyl is not set */
  448.  
  449. #define XADDIF_CRYPTED         (1<<XADDIB_CRYPTED)
  450. #define XADDIF_SEEKDATAPOS     (1<<XADDIB_SEEKDATAPOS)
  451.  
  452. #define XADDIF_GUESSCYLINDERS     (1<<XADDIB_GUESSCYLINDERS)
  453. #define XADDIF_GUESSCYLSECTORS     (1<<XADDIB_GUESSCYLSECTORS)
  454. #define XADDIF_GUESSHEADS     (1<<XADDIB_GUESSHEADS)
  455. #define XADDIF_GUESSTRACKSECTORS (1<<XADDIB_GUESSTRACKSECTORS)
  456. #define XADDIF_GUESSLOWCYL     (1<<XADDIB_GUESSLOWCYL)
  457. #define XADDIF_GUESSHIGHCYL     (1<<XADDIB_GUESSHIGHCYL)
  458.  
  459. #define XADDIF_NOCYLINDERS     (1<<XADDIB_NOCYLINDERS)
  460. #define XADDIF_NOCYLSECTORS     (1<<XADDIB_NOCYLSECTORS)
  461. #define XADDIF_NOHEADS         (1<<XADDIB_NOHEADS)
  462. #define XADDIF_NOTRACKSECTORS     (1<<XADDIB_NOTRACKSECTORS)
  463. #define XADDIF_NOLOWCYL         (1<<XADDIB_NOLOWCYL)
  464. #define XADDIF_NOHIGHCYL     (1<<XADDIB_NOHIGHCYL)
  465.  
  466. /* defines for BlockInfo */
  467. #define XADBIB_CLEARED        0 /* this block was cleared for archiving */
  468. #define XADBIB_UNUSED        1 /* this block was not archived */
  469.  
  470. #define XADBIF_CLEARED        (1<<XADBIB_CLEARED)
  471. #define XADBIF_UNUSED        (1<<XADBIB_UNUSED)
  472.  
  473. /************************************************************************
  474. *                                                *
  475. *    progress report stuff                              *
  476. *                                                *
  477. ************************************************************************/
  478.  
  479. struct xadProgressInfo {
  480.   ULONG            xpi_Mode;    /* work modus */
  481.   struct xadClient *    xpi_Client;    /* the client doing the work */
  482.   struct xadDiskInfo *    xpi_DiskInfo;    /* current diskinfo, for disks */
  483.   struct xadFileInfo *    xpi_FileInfo;    /* current info for files */
  484.   ULONG            xpi_CurrentSize;/* current filesize */
  485.   ULONG            xpi_LowCyl;    /* for disks only */
  486.   ULONG            xpi_HighCyl;    /* for disks only */
  487.   ULONG            xpi_Status;    /* see XADPIF flags */
  488.   LONG            xpi_Error;    /* any of the error codes */
  489.   STRPTR        xpi_FileName;    /* name of file to overwrite (V2) */
  490.   STRPTR        xpi_NewName;    /* new name buffer, passed by hook (V2) */
  491. };
  492. /* NOTE: For disks CurrentSize is Sector*SectorSize, where SectorSize can
  493. be found in xadDiskInfo structure. So you may output the sector value. */
  494.  
  495. /* different progress modes */
  496. #define XADPMODE_ASK        1
  497. #define XADPMODE_PROGRESS    2
  498. #define XADPMODE_END        3
  499. #define XADPMODE_ERROR        4
  500.  
  501. /* flags for progress hook and ProgressInfo status field */
  502. #define XADPIB_OVERWRITE     0 /* overwrite the file */
  503. #define XADPIB_MAKEDIRECTORY     1 /* create the directory */
  504. #define XADPIB_IGNOREGEOMETRY     2 /* ignore drive geometry */
  505. #define XADPIB_RENAME        10 /* rename the file (V2) */
  506. #define XADPIB_OK        16 /* all ok, proceed */
  507. #define XADPIB_SKIP        17 /* skip file */
  508.  
  509. #define XADPIF_OVERWRITE    (1<<XADPIB_OVERWRITE)
  510. #define XADPIF_MAKEDIRECTORY    (1<<XADPIB_MAKEDIRECTORY)
  511. #define XADPIF_IGNOREGEOMETRY    (1<<XADPIB_IGNOREGEOMETRY)
  512. #define XADPIF_RENAME        (1<<XADPIB_RENAME)
  513. #define XADPIF_OK        (1<<XADPIB_OK)
  514. #define XADPIF_SKIP        (1<<XADPIB_SKIP)
  515.  
  516. /************************************************************************
  517. *                                                *
  518. *    errors                                       *
  519. *                                                *
  520. ************************************************************************/
  521.  
  522. #define XADERR_OK        0x0000 /* no error */
  523. #define XADERR_UNKNOWN        0x0001 /* unknown error */
  524. #define XADERR_INPUT        0x0002 /* input data buffers border exceeded */
  525. #define XADERR_OUTPUT        0x0003 /* output data buffers border exceeded */
  526. #define XADERR_BADPARAMS    0x0004 /* function called with illegal parameters */
  527. #define XADERR_NOMEMORY        0x0005 /* not enough memory available */
  528. #define XADERR_ILLEGALDATA    0x0006 /* data is corrupted */
  529. #define XADERR_NOTSUPPORTED    0x0007 /* command is not supported */
  530. #define XADERR_RESOURCE        0x0008 /* required resource missing */
  531. #define XADERR_DECRUNCH        0x0009 /* error on decrunching */
  532. #define XADERR_FILETYPE        0x000A /* unknown file type */
  533. #define XADERR_OPENFILE        0x000B /* opening file failed */
  534. #define XADERR_SKIP        0x000C /* file, disk has been skipped */
  535. #define XADERR_BREAK        0x000D /* user break in progress hook */
  536. #define XADERR_FILEEXISTS    0x000E /* file already exists */
  537. #define XADERR_PASSWORD        0x000F /* missing or wrong password */
  538. #define XADERR_MAKEDIR        0x0010 /* could not create directory */
  539. #define XADERR_CHECKSUM        0x0011 /* wrong checksum */
  540. #define XADERR_VERIFY        0x0012 /* verify failed (disk hook) */
  541. #define XADERR_GEOMETRY        0x0013 /* wrong drive geometry */
  542. #define XADERR_DATAFORMAT    0x0014 /* unknown data format */
  543. #define XADERR_EMPTY        0x0015 /* source contains no files */
  544. #define XADERR_FILESYSTEM    0x0016 /* unknown filesystem */
  545.  
  546. /************************************************************************
  547. *                                                *
  548. *    client related stuff                           *
  549. *                                                *
  550. ************************************************************************/
  551.  
  552. struct xadForeman {
  553.   ULONG             xfm_Security;    /* should be XADFOREMAN_SECURITY */
  554.   ULONG             xfm_ID;          /* must be XADFOREMAN_ID */
  555.   UWORD             xfm_Version;     /* set to XADFOREMAN_VERSION */
  556.   UWORD             xfm_Reserved;
  557.   STRPTR         xfm_VersString;  /* pointer to $VER: string */
  558.   struct xadClient * xfm_FirstClient; /* pointer to first client */
  559. };
  560.  
  561. #define XADFOREMAN_SECURITY    0x70FF4E75 /* MOVEQ #-1,D0 and RTS */
  562. #define XADFOREMAN_ID        0x58414446 /* 'XADF' identification ID */
  563. #define XADFOREMAN_VERSION    1
  564.  
  565. struct xadClient {
  566.   struct xadClient * xc_Next;
  567.   UWORD             xc_Version;    /* set to XADCLIENT_VERSION */
  568.   UWORD             xc_MasterVersion;
  569.   UWORD             xc_ClientVersion;
  570.   UWORD             xc_ClientRevision;
  571.   ULONG             xc_RecogSize;  /* needed size to recog the type */
  572.   ULONG             xc_Flags;      /* see XADCF_xxx defines */
  573.   ULONG             xc_Identifier; /* ID of internal clients */
  574.   STRPTR         xc_ArchiverName;
  575.   BOOL          (* xc_RecogData)();
  576.   LONG          (* xc_GetInfo)();
  577.   LONG          (* xc_UnArchive)();
  578.   void          (* xc_Free)();
  579. };
  580.  
  581. /* function interface
  582. ASM(BOOL) xc_RecogData(REG(d0, ULONG size), REG(a0, STRPTR data),
  583.         REG(a6, struct xadMasterBase *xadMasterBase));
  584. ASM(LONG) xc_GetInfo(REG(a0, struct xadArchiveInfo *ai),
  585.         REG(a6, struct xadMasterBase *xadMasterBase));
  586. ASM(LONG) xc_UnArchive(REG(a0, struct xadArchiveInfo *ai),
  587.         REG(a6, struct xadMasterBase *xadMasterBase));
  588. ASM(void) xc_Free(REG(a0, struct xadArchiveInfo *ai),
  589.         REG(a6, struct xadMasterBase *xadMasterBase));
  590. */
  591.  
  592. /* xc_RecogData returns 1 when recognized and 0 when not, all the others
  593.    return 0 when ok and XADERR values on error. xc_Free has no return
  594.    value.
  595.  
  596.    Filesystem clients need to clear xc_RecogSize and xc_RecogData. The
  597.    recognition is automatically done by GetInfo. XADERR_FILESYSTEM is
  598.    returned in case of unknown format. If it is known detection should
  599.    go on and any other code may be returned, if it fails.
  600.    The field xc_ArchiverName means xc_FileSystemName for filesystem
  601.    clients.
  602. */
  603.  
  604. #define XADCLIENT_VERSION    1
  605.  
  606. #define XADCB_FILEARCHIVER     0 /* archiver is a file archiver */
  607. #define XADCB_DISKARCHIVER     1 /* archiver is a disk archiver */
  608. #define XADCB_EXTERN         2 /* external client, set by xadmaster */
  609. #define XADCB_FILESYSTEM     3 /* filesystem clients (V5) */
  610. #define XADCB_NOCHECKSIZE     4 /* do not check size for recog call (V6) */
  611. #define XADCB_FREESKIPINFO    27 /* master frees xadSkipInfo structures (V3) */
  612. #define XADCB_FREETEXTINFO    28 /* master frees xadTextInfo structures (V2) */
  613. #define XADCB_FREETEXTINFOTEXT    29 /* master frees xadTextInfo text block (V2) */
  614. #define XADCB_FREEFILEINFO    30 /* master frees xadFileInfo structures (V2) */
  615. #define XADCB_FREEDISKINFO    31 /* master frees xadDiskInfo structures (V2) */
  616.  
  617. #define XADCF_FILEARCHIVER    (1<<XADCB_FILEARCHIVER)
  618. #define XADCF_DISKARCHIVER    (1<<XADCB_DISKARCHIVER)
  619. #define XADCF_EXTERN        (1<<XADCB_EXTERN)
  620. #define XADCF_FILESYSTEM    (1<<XADCB_FILESYSTEM)
  621. #define XADCF_NOCHECKSIZE    (1<<XADCB_NOCHECKSIZE)
  622. #define XADCF_FREESKIPINFO    (1<<XADCB_FREESKIPINFO)
  623. #define XADCF_FREETEXTINFO    (1<<XADCB_FREETEXTINFO)
  624. #define XADCF_FREETEXTINFOTEXT    (1<<XADCB_FREETEXTINFOTEXT)
  625. #define XADCF_FREEFILEINFO    (1<<XADCB_FREEFILEINFO)
  626. #define XADCF_FREEDISKINFO    (1<<XADCB_FREEDISKINFO)
  627.  
  628. /************************************************************************
  629. *                                                *
  630. *    client ID's                                   *
  631. *                                                *
  632. ************************************************************************/
  633.  
  634. /* If an external client has set the xc_Identifier field, the internal
  635. client is replaced. */
  636.  
  637. /* disk archivers start with 1000 */
  638. #define XADCID_XMASH            1000
  639. #define XADCID_SUPERDUPER3        1001
  640. #define XADCID_XDISK            1002
  641. #define XADCID_PACKDEV            1003
  642. #define XADCID_ZOOM            1004
  643. #define XADCID_ZOOM5            1005
  644. #define XADCID_CRUNCHDISK        1006
  645. #define XADCID_PACKDISK            1007
  646. #define XADCID_MDC            1008
  647. #define XADCID_COMPDISK            1009
  648. #define XADCID_LHWARP            1010
  649. #define XADCID_SAVAGECOMPRESSOR        1011
  650.  
  651. /* file archivers start with 5000 */
  652. #define XADCID_TAR            5000
  653. #define XADCID_SDSSFX            5001
  654. #define XADCID_LZX            5002
  655. #define XADCID_MXMSIMPLEARC        5003
  656. #define XADCID_LHPAK            5004
  657. #define XADCID_AMIGAPLUSUNPACK        5005
  658. #define XADCID_AMIPACK            5006
  659. #define XADCID_LHA            5007
  660. #define XADCID_LHASFX            5008
  661. #define XADCID_PCOMPARC            5009
  662. #define XADCID_SOMNI            5010
  663. #define XADCID_LHSFX            5011
  664. #define XADCID_XPKARCHIVE        5012
  665. #define XADCID_SHRINK            5013
  666. #define XADCID_SPACK            5014
  667. #define XADCID_SPACKSFX            5015
  668. #define XADCID_ZIP            5016
  669. #define XADCID_WINZIPEXE        5017
  670. #define XADCID_GZIP            5018
  671. #define XADCID_ARC            5019
  672. #define XADCID_ZOO            5020
  673. #define XADCID_LHAEXE            5021
  674. #define XADCID_ARJ            5022
  675. #define XADCID_ARJEXE            5023
  676. #define XADCID_ZIPEXE            5024
  677. #define XADCID_LHF            5025
  678. #define XADCID_COMPRESS            5026
  679. #define XADCID_ACE            5027
  680. #define XADCID_ACEEXE            5028
  681.  
  682. /* filesystem client start with 8000 */
  683.  
  684. #define XADCID_FSAMIGA            8000
  685. #define XADCID_FSSANITYOS        8001
  686. #define XADCID_FSFAT            8002
  687.  
  688. /* mixed archivers start with 9000 */
  689. #define XADCID_DMS            9000
  690. #define XADCID_DMSSFX            9001
  691.  
  692. #endif /* LIBRARIES_XADMASTER_H */
  693.